//
//  displayPrePostGamestate.c
//  Dominion
//
//  Created by Eric Hook on 2/13/14.
//  Copyright (c) 2014 Eric Hook. All rights reserved.
//

#include "headers.h"

void showPrePostGameState(struct gameState *post, struct gameState *pre){
    printf(".....\n");
    printf("WhoseTurnPre: %i   WhoseTurnPost: %i \n",   pre->whoseTurn, post->whoseTurn);                             //PRE POST coins
    printf("CoinsPre:     %i   CoinsPost:     %i \n",   pre->coins, post->coins);                             //PRE POST coins
    printf("ActionsPre:   %i   Actions:       %i \n",   pre->numActions, post->numActions);                   //PRE POST numActions
    printf("numBuysPre:   %i   numBuysPost:   %i \n",   pre->numBuys, post->numBuys);                         //PRE POST numBuys
    printf("phasePre:     %i   phasePost:     %i \n",   pre->phase, post->phase);                             //PRE POST phase
    printf(".....\n");
    
    for (int i = 0; i < pre->numPlayers; i++){                                                          //PRE POST hands
        printf("Player %i PRE handCount (%i cards): ", i, pre->handCount[i]);
        for (int j = 0; j < pre->handCount[i]; j++){
            printf("%i, ", pre->hand[i][j]);
        }
        printf("\t");
        printf("POST handCards (%i cards) : ", post->handCount[i]);
        for (int j = 0; j < post->handCount[i]; j++){
            printf("%i, ", post->hand[i][j]);
        }
        printf("\n");
    }
    printf(".....\n");
    
    for (int i = 0; i < pre->numPlayers; i++){                                                          //PRE POST deck
        printf("Player %i PRE deck (%i cards): ", i, pre->deckCount[i]);
        for (int j = 0; j < pre->deckCount[i]; j++){
            printf("%i, ", pre->deck[i][j]);
        }
        printf("\t");
        printf("POST deck (%i cards) : ", post->deckCount[i]);
        for (int j = 0; j < post->deckCount[i]; j++){
            printf("%i, ", post->deck[i][j]);
        }
        printf("\n");
    }
    printf(".....\n");
    
    for (int i = 0; i < pre->numPlayers; i++){                                                          //PRE POST discard
        printf("Player %i PRE discard (%i cards): ", i, pre->discardCount[i]);
        for (int j = 0; j < pre->discardCount[i]; j++){
            printf("%i, ", pre->discard[i][j]);
        }
        printf("\t");
        printf("POST discard (%i cards) : ", post->discardCount[i]);
        for (int j = 0; j < post->discardCount[i]; j++){
            printf("%i, ", post->discard[i][j]);
        }
        printf("\n");
    }
    printf(".....\n");
    
    printf("PRE playedCards (%i cards): ", pre->playedCardCount);                                   //PRE POST playedCards
    for (int j = 0; j < pre->playedCardCount; j++){
        printf("%i, ", pre->playedCards[j]);
    }
    printf("\t");
    printf("POST playedCards (%i cards) : ", post->playedCardCount);
    for (int j = 0; j < post->playedCardCount; j++){
        printf("%i, ", post->playedCards[j]);
    }
    printf("\n.....\n");
    
    printf("PRE/POST supplyCounts: \n");                                   //PRE POST numactions
    for (int i = 0; i < (sizeof(pre->supplyCount)/(sizeof(int))); i++){
        printf("%i(%i/%i)  ", i, pre->supplyCount[i], post->supplyCount[i]);
        if (i%10 == 0 && i>1) printf("\n");
    }
    printf("\n.....\n");
    printInterface(pre->whoseTurn, pre);
}

void printInterface(int player, struct gameState *game){
    printDeck(player, game);
    printDiscard(player, game);
    printHand(player, game);
    printHelp();
    printPlayed(player, game);
    printScores(game);
    printState(game);
    printSupply(game);
}
